<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- <link
    rel="stylesheet"
    href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"
  /> -->
    <script src="../框架相关的js/vue.js"></script>
    <script src="../框架相关的js/jquery-3.6.0.min.js"></script>
    <title></title>
    <style>
        .box {
            width: 100px;
            height: 100px;
            background-color: red;

        }

        input {
            display: none;
        }
    </style>
</head>

<body>
    <div class="box animate__animated animate__backInDown"></div>
    <div id="app">

        <div v-for="(item,index) in arr">
            <span @click="edit($event,item.name,index)">{{item.name}}</span> <span @click="del(index)">删除</span>
            <input type="text">
        </div>

    </div>

    <script>

        new Vue({
            el: '#app',
            data: {
                arr: [{ id: 1, name: '张三' }, { id: 2, name: '李四' }, { id: 3, name: '王二麻子' }, { id: 4, name: '西门' }]
            },
            methods: {
                del(index) {
                    console.log(index);
                    this.arr.splice(index, 1)
                },
                edit(e, val, index) {
                    console.log(e.target);
                    console.log($(e.target).parent().find('input')[0], '///');
                    Array.from(document.querySelectorAll('input')).forEach(item => {
                        item.style.display = 'none'
                    })
                    $(e.target).parent().find('input')[0].style.display = 'block'
                    $(e.target).parent().find('input')[0].value = val
                }
            }
        })

    </script>
</body>

</html>